﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace LineChartControlTest
{
    /// <summary>
    /// StraightFittingCurve.xaml 的交互逻辑
    /// </summary>
    public partial class StraightFittingCurve : Window
    {
        public StraightFittingCurve()
        {
            InitializeComponent();
            AddData();
        }

        private void AddData()
        {
            LineCharts.FittingCurve ds = new LineCharts.FittingCurve();
            ds.LineColor = Brushes.Blue;
            ds.FittingMode = LineCharts.FittingCurve.FittingModeEnum.StraightLineFit;
            ds.LineThickness = 2;
            ds.SeriesName = "Straight Fit";
            ds.Symbols.SymbolType = LineCharts.Symbols.SymbolTypeEnum.Diamond;
            ds.Symbols.FillColor = Brushes.Transparent;
            ds.Symbols.BorderColor = ds.LineColor;
            double[] x = new double[] { 0, 1, 2, 3, 4, 5 };
            double[] y = new double[] { 1.9, 2.7, 3.3, 4.4, 5.5, 6.5 };

            for (int i = 0; i < x.Length; i++)
            {
                ds.RawData.Add(x[i], y[i]);
            }
            myLineChart.SeriesCollection.AddRawData(ds);
        }
    }
}
